<template>
  <el-container style="padding: 0">
    <el-aside width="200px">
      <el-menu
        default-active="this.$route.path"
        class="el-menu-vertical-demo"
        background-color="#545c64"
        router
        text-color="#fff"
        active-text-color="#ffd04b">
        <el-menu-item v-for="(a,i) in testList" :key="i" :index="a.path">
          <i class="el-icon-menu"></i>
          <template slot="title">
            <span>{{ a.Name }}</span>
          </template>
        </el-menu-item>
      </el-menu>
    </el-aside>
    <el-main>
      <div class="breadcrumb" style="padding: 5px 0px 10px 0px">
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item v-for="(item, index) in breadcrumb" :key="index" :to="{path: item.path}">
            {{ item.meta.title }}
          </el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <router-view></router-view>
    </el-main>
  </el-container>
</template>

<script>
export default {
  name: "Main",
  data() {
    return {
      testList: [
        {path: "/item/list", Name: "商品管理"},
        {path: "/order/list", Name: "订单管理"}
      ]
    }
  },
  computed: {
    routes() {
      return this.$router.options.routes.filter((item) => {
          return item.meta.showInbreadcrumb
        }
      );
    },

    breadcrumb() {
      let matachedArr = this.$route.matched.filter((item) => {
        return item.meta.showInbreadcrumb
      });
      return matachedArr
    }
  }
}
</script>

<style scoped>

</style>
